package com.angel.arquitectura.service.impl.multiple;

import com.angel.arquitectura.model.command.SpringMultipleServiceCommand;
import com.angel.arquitectura.model.common.PersistentObject;
import com.angel.arquitectura.service.impl.GenericServiceImpl;
import com.angel.arquitectura.service.multiple.MultipleService;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author William
 */
public class MultipleServiceImpl extends GenericServiceImpl implements MultipleService{

    public List<Object> execute(List<SpringMultipleServiceCommand> multiplesServicesCommands) {
        List<Object> resultados = new ArrayList<Object>();
        for (SpringMultipleServiceCommand multiplesServicesCommand : multiplesServicesCommands) {
            resultados.add(multiplesServicesCommand.execute());
        }
        return resultados;
    }

    @Override
    public PersistentObject create(PersistentObject persistentObject){
        return persistentObject;
    }

    @Override
    public PersistentObject update(Object persistentObject){
        return (PersistentObject) persistentObject;
    }

    @Override
    public void remove(Object persistentObject){ }
}
